package com.zhejiangzhengyuan.municipal_manhole_cover.controller;

import com.zhejiangzhengyuan.municipal_common.entity.vo.DeviceVo;
import com.zhejiangzhengyuan.municipal_common.response.ResponseVo;
import com.zhejiangzhengyuan.municipal_common.service.DeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author :linju
 * @create on : 2019/12/3
 */
@RestController
@Slf4j
@RequestMapping("/cover/timeMonitoring")
@Api(tags = "井盖实时监控")
// 验证单个参数
@Validated
public class TimeMonitoringController {

  @Autowired private DeviceService deviceService;

  @ApiOperation(value = "查询设备跟设施", response = DeviceVo.class)
  @GetMapping("/getDeviceAndFacility")
  public ResponseVo getDeviceAndFacility() {
    List<DeviceVo> deviceVos = deviceService.getDeviceAndFacility("井盖设备");
    return deviceVos == null ? ResponseVo.SERVER_ERROR : ResponseVo.successWithData(deviceVos);
  }
}
